package com.wjy.common.util;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author wjy
 * @data 2019年3月11日
 * @desc 读取配置文件
 */
@Component
@Data
@PropertySource(value = "classpath:resources.properties")
public class PropertiesUtil {

    @Autowired
    private Environment environment;

    public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
        return environment.getProperty(key, targetType, defaultValue);
    }

}
